<template>
  <s-table
    bordered
    ref="table"
    :row-key="(record) => record.cb_id"
    :columns="businessColumns"
    :data="businessData"
  >
    <template slot="status2_name" slot-scope="text">
      <a-tag>{{text}}</a-tag>
    </template>
    <template slot="action" slot-scope="text, record">
      <a-button type="primary" size="small" @click="toDetail(record.cb_id)">详情</a-button>
    </template>
  </s-table>
</template>

<script>
import { STable } from '@/components'
import { getMemberDetail } from '@/api/member'
export default {
  components: {
    STable
  },
  name: 'MBusiness',
  data () {
    return {
      businessColumns: [
        {
          title: '业务编号',
          dataIndex: 'business_no'
        },
        {
          title: '业务名称',
          dataIndex: 'sb_name'
        },
        {
          title: '商标类别',
          dataIndex: 'sb_category'
        },
        {
          title: '业务小类',
          dataIndex: 'business_name'
        },
        {
          title: '业务价格',
          dataIndex: 'price'
        },
        {
          title: '业务状态',
          dataIndex: 'status2_name',
          scopedSlots: { customRender: 'status2_name' }
        },
        {
          title: '审核时间',
          dataIndex: 'submit_mats_time'
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
      businessData: parameters => {
        return getMemberDetail(Object.assign(parameters, this.queryParam)).then(res => {
          this.statusOpts = res.result.status_opts
          return res.result
        })
      },
      queryParam: {},
      statusOpts: {}
    }
  },
  created () {
    this.queryParam['uid'] = this.$route.params.id
    this.queryParam['type'] = 1
  },
  methods: {
    toDetail (id) {
      this.$router.push({ name: 'BusinessDetail', params: { id: id } })
    }
  }
}
</script>

<style scoped>

</style>
